load("@rules_java//java:defs.bzl", "java_library")
load("//:cel_android_rules.bzl", "cel_android_library")

package(
    default_applicable_licenses = [
        "//:license",
    ],
    default_visibility = [
        "//extensions:__pkg__",
        "//publish:__pkg__",
    ],
)

java_library(
    name = "extension_library",
    srcs = ["CelExtensionLibrary.java"],
    tags = [
    ],
    deps = [
        "//common:compiler_common",
        "//parser:macro",
        "@maven//:com_google_guava_guava",
    ],
)

java_library(
    name = "extensions",
    srcs = ["CelExtensions.java"],
    tags = [
    ],
    deps = [
        ":bindings",
        ":comprehensions",
        ":encoders",
        ":lists",
        ":math",
        ":optional_library",
        ":protos",
        ":regex",
        ":sets",
        ":sets_function",
        ":strings",
        "//common:options",
        "//extensions:extension_library",
        "@maven//:com_google_guava_guava",
    ],
)

java_library(
    name = "lite_extensions",
    srcs = ["CelLiteExtensions.java"],
    tags = [
    ],
    deps = [
        ":sets_function",
        ":sets_runtime_impl",
        "//common:options",
        "//runtime:runtime_equality",
        "//runtime:runtime_helpers",
        "@maven//:com_google_guava_guava",
    ],
)

cel_android_library(
    name = "lite_extensions_android",
    srcs = ["CelLiteExtensions.java"],
    tags = [
    ],
    deps = [
        ":sets_function",
        ":sets_runtime_impl_android",
        "//common:options",
        "//runtime:runtime_equality_android",
        "//runtime:runtime_helpers_android",
        "@maven_android//:com_google_guava_guava",
    ],
)

java_library(
    name = "strings",
    srcs = ["CelStringExtensions.java"],
    tags = [
    ],
    deps = [
        "//checker:checker_builder",
        "//common:compiler_common",
        "//common/internal",
        "//common/types",
        "//compiler:compiler_builder",
        "//extensions:extension_library",
        "//runtime",
        "//runtime:evaluation_exception_builder",
        "//runtime:function_binding",
        "@maven//:com_google_errorprone_error_prone_annotations",
        "@maven//:com_google_guava_guava",
    ],
)

java_library(
    name = "protos",
    srcs = ["CelProtoExtensions.java"],
    deps = [
        "//common:compiler_common",
        "//common/ast",
        "//common/internal",
        "//compiler:compiler_builder",
        "//extensions:extension_library",
        "//parser:macro",
        "//parser:parser_builder",
        "@maven//:com_google_errorprone_error_prone_annotations",
        "@maven//:com_google_guava_guava",
    ],
)

java_library(
    name = "math",
    srcs = ["CelMathExtensions.java"],
    tags = [
    ],
    deps = [
        ":extension_library",
        "//checker:checker_builder",
        "//common:compiler_common",
        "//common:options",
        "//common/ast",
        "//common/internal:comparison_functions",
        "//common/types",
        "//compiler:compiler_builder",
        "//parser:macro",
        "//parser:parser_builder",
        "//runtime",
        "//runtime:function_binding",
        "@maven//:com_google_errorprone_error_prone_annotations",
        "@maven//:com_google_guava_guava",
    ],
)

java_library(
    name = "bindings",
    srcs = ["CelBindingsExtensions.java"],
    deps = [
        "//common:compiler_common",
        "//common/ast",
        "//compiler:compiler_builder",
        "//extensions:extension_library",
        "//parser:macro",
        "//parser:parser_builder",
        "@maven//:com_google_errorprone_error_prone_annotations",
        "@maven//:com_google_guava_guava",
    ],
)

java_library(
    name = "encoders",
    srcs = ["CelEncoderExtensions.java"],
    deps = [
        "//checker:checker_builder",
        "//common:compiler_common",
        "//common:options",
        "//common/types",
        "//common/values:cel_byte_string",
        "//compiler:compiler_builder",
        "//extensions:extension_library",
        "//runtime",
        "//runtime:function_binding",
        "@maven//:com_google_errorprone_error_prone_annotations",
        "@maven//:com_google_guava_guava",
        "@maven//:com_google_protobuf_protobuf_java",
    ],
)

java_library(
    name = "optional_library",
    srcs = ["CelOptionalLibrary.java"],
    tags = [
    ],
    deps = [
        "//checker:checker_builder",
        "//common:compiler_common",
        "//common:options",
        "//common/ast",
        "//common/types",
        "//common/values",
        "//common/values:cel_byte_string",
        "//compiler:compiler_builder",
        "//extensions:extension_library",
        "//parser:macro",
        "//parser:operator",
        "//parser:parser_builder",
        "//runtime",
        "//runtime:function_binding",
        "//runtime:runtime_equality",
        "@maven//:com_google_guava_guava",
        "@maven//:com_google_protobuf_protobuf_java",
    ],
)

java_library(
    name = "sets",
    srcs = ["CelSetsExtensions.java"],
    tags = [
    ],
    deps = [
        ":sets_function",
        ":sets_runtime_impl",
        "//checker:checker_builder",
        "//common:compiler_common",
        "//common:options",
        "//common/internal:default_message_factory",
        "//common/internal:dynamic_proto",
        "//common/types",
        "//compiler:compiler_builder",
        "//extensions:extension_library",
        "//runtime",
        "//runtime:proto_message_runtime_equality",
        "@maven//:com_google_errorprone_error_prone_annotations",
        "@maven//:com_google_guava_guava",
    ],
)

java_library(
    name = "sets_function",
    srcs = ["SetsFunction.java"],
    # used_by_android
    tags = [
    ],
)

java_library(
    name = "sets_runtime_impl",
    srcs = ["SetsExtensionsRuntimeImpl.java"],
    visibility = ["//visibility:private"],
    deps = [
        ":sets_function",
        "//runtime:function_binding",
        "//runtime:lite_runtime",
        "//runtime:runtime_equality",
        "@maven//:com_google_errorprone_error_prone_annotations",
        "@maven//:com_google_guava_guava",
    ],
)

cel_android_library(
    name = "sets_runtime_impl_android",
    srcs = ["SetsExtensionsRuntimeImpl.java"],
    visibility = ["//visibility:private"],
    deps = [
        ":sets_function",
        "//runtime:function_binding_android",
        "//runtime:lite_runtime_android",
        "//runtime:runtime_equality_android",
        "@maven//:com_google_errorprone_error_prone_annotations",
        "@maven_android//:com_google_guava_guava",
    ],
)

java_library(
    name = "lists",
    srcs = ["CelListsExtensions.java"],
    tags = [
    ],
    deps = [
        "//checker:checker_builder",
        "//common:compiler_common",
        "//common:options",
        "//common/ast",
        "//common/internal:comparison_functions",
        "//common/types",
        "//compiler:compiler_builder",
        "//extensions:extension_library",
        "//parser:macro",
        "//parser:operator",
        "//parser:parser_builder",
        "//runtime",
        "//runtime:function_binding",
        "//runtime:runtime_equality",
        "@maven//:com_google_guava_guava",
    ],
)

java_library(
    name = "regex",
    srcs = ["CelRegexExtensions.java"],
    deps = [
        "//checker:checker_builder",
        "//common:compiler_common",
        "//common/types",
        "//compiler:compiler_builder",
        "//extensions:extension_library",
        "//runtime",
        "//runtime:function_binding",
        "@maven//:com_google_errorprone_error_prone_annotations",
        "@maven//:com_google_guava_guava",
        "@maven//:com_google_re2j_re2j",
    ],
)

java_library(
    name = "comprehensions",
    srcs = ["CelComprehensionsExtensions.java"],
    deps = [
        "//common:compiler_common",
        "//common/ast",
        "//compiler:compiler_builder",
        "//parser:macro",
        "//parser:operator",
        "//parser:parser_builder",
        "@maven//:com_google_guava_guava",
    ],
)
